package com.xrit.sunnyday.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.xrit.sunnyday.dao.MenuDao;
import com.xrit.sunnyday.pojo.Menu;
import com.xrit.sunnyday.pojo.MenuExtend;
import com.xrit.sunnyday.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author Daoying
 * creationTime: 2022/10/26 13:39
 */
@Service(interfaceClass = MenuService.class)
public class MenuServiceImpl implements MenuService {

    @Autowired
    private MenuDao menuDao;

    /*
     * 查询所有菜单
     * */
    @Override
    public List<Menu> findAll() {
        return menuDao.findAll();
    }

    /*
     * 动态查询菜单
     * */
    @Override
    public List<Menu> findByRoid(int id) {
        return menuDao.findByRoid(id);
    }

    /*
     * 查询全部菜单及子菜单
     * */
    @Override
    public List<MenuExtend> QueryMenuAll() {
        List<MenuExtend> menuExtends = menuDao.QueryMenuAll();
        return menuExtends;
    }

    /**
     * 添加菜单
     */
    @Override
    public void MenuAdd(Menu menu) {
        menuDao.MenuAdd(menu);
    }

}
